﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace Game.Dialogs
{
    public partial class NewMap : Form
    {
        #region Initialisieren
        //Konstruktor
        public NewMap()
        {
            InitializeComponent();

            //Textboxen füllen
            tbWidth.Text    = sliderWidth.Value.ToString();
            tbHeight.Text   = sliderHeight.Value.ToString();
        }
        #endregion

        #region Events
        //Textboxen bei änderungen am slider aktualisieren
        private void sliderWidth_ValueChanged(object sender, EventArgs e)
        {
            tbWidth.Text = sliderWidth.Value.ToString();
        }

        private void sliderHeight_ValueChanged(object sender, EventArgs e)
        {
            tbHeight.Text = sliderHeight.Value.ToString();
        }

        //Schließen falls Abbrechen geklickt wird
        private void btCancel_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        //Neue Map erstellen
        private void btCreate_Click(object sender, EventArgs e)
        {
            Session.fenster.showEditor(new Size(int.Parse(tbWidth.Text), int.Parse(tbHeight.Text)));
            this.Close();
        }
        #endregion
    }
}
